<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Canvas使用</title>
</head>

<body onload="draw();">
  <div>
    <canvas id="tutorial" width="150" height="150" style="border:1px solid #000000;">
    </canvas>
  </div>
</body>
<script>
  function draw() {
        var canvas = document.getElementById("tutorial");
        if (canvas.getContext) {
          var ctx = canvas.getContext("2d");

          ctx.fillStyle = "rgb(200,0,0)";
          ctx.fillRect(20, 10, 100, 100);// x,y,width,height

          ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
          ctx.fillRect(30, 30, 55, 50);
        }
      }
</script>
</html>